/**
 * Copyright (c) 2009 blurredVision
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
 * associated documentation files (the "Software"), to deal in the Software without restriction, 
 * including without limitation the rights to use, copy, modify, merge, publish, distribute, 
 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or 
 * substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT 
 * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT 
 * OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
#ifndef __ISOUND_H__
#define __ISOUND_H__

#pragma once

#include "IAudio.h"

namespace audio {

	class DLL_EXPORT ISound
{
public:
	ISound(void);
	
	/**
	*	Start sound
	*/
	virtual bool play()=0;
	
	/**
	*	Start ths sound by fading in.
	*	\param float fFadeTime
	*/
	virtual bool play_fadeIn(float fFadeTime)=0;
	
	/**
	*	Stop sound
	*/
	virtual void stop()=0;

	/**
	*	Fade out the sound and stop it afterwards.
	*	\param float fFadeTime
	*/
	virtual void fadeAndStop(float fFadeTime)=0;

	/**
	 *	Set the number of voices, i.e. the number of times one sound can be played parallel
	 *	\param unsigned int _val
	 */
	virtual void setNumVoices(int _val) = 0;
	
	/**
	*	Change volume. This should effect the sound while it is playing.
	*/
	void setVolume(const float &vol);

	/*
	*	Get the state of the ISound:
	*	ISOUND_PLAYING, ISOUND_STOPPED...
	*/
	virtual int getState()=0;

	/*
	*	Set the loop-variable
	*/
	void setLoop(bool _val);

	/*
	*	Returns the loop-variable
	*/
	bool getLoop();

	/*
	*	Update loop. Should only be called, when sound is playing
	*/
	virtual void update(const double &dt)=0;

	/**
	*	Sets the priority of the sound. It is used for soundchanel-handling.
	*	Priority are ordered form 1 (highest priority) to 10 (lowest priority)
	*	Default priority is 5.
	*/
	void setPriority(int _val);

	/**
	*	Returns the priority of the sound
	*/
	int getPriority();

	/**
	*	Returns the id of the sound
	*/
	SfxID getSoundID();

	/**
	*	set the id of the sound
	*/
	void setSoundID(SfxID id);

	/**
	*	Set if global mute of audioengine
	*	will be ignored
	*/
	void ignoreMute(bool _val);

protected:
	virtual ~ISound(void);

	int m_iPriority;	///< Priority of the sound
	bool m_bLoop;		///< Play sound in loop?
	float m_fVolume;	///< Volume of this sound 
	bool m_bIgnoreMute;	///< Ignore global mute from AudioEngine
	SfxID m_ID;			///< The sound id of the sound
	

};

}
#endif // __ISOUND_H__